<template>
	<view class="bizPage">
		<status-bar title="档案详情" />
		<view class="padding20">
			<view class="head bgwhite d-flex a-center m-bot20 p-re">
				<view class="back p-ab"></view>
				<image class="avatar m-right12" :src="pageData.avatar ? imgUrls(pageData.avatar) : staticImg + 'noExist.jpg'" mode="aspectFill"></image>
				<view class="flex-1 size32 color-222 bold">{{ pageData.name }}</view>
				<view class="size26 color-666">{{ pageData.deptName }}</view>
			</view>
			<view class="main bgwhite row">
				<view class="item d-flex a-center" @click="toUrl(item.path)" v-for="(item,index) in list" :key="index">
					<image class="icon m-right20" :src="staticImg + item.icon" mode="aspectFit"></image>
					<view class="flex-1 size28">{{ item.title }}</view>
					<text class="iconfont icon-a-zujian32 size24 color-999"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref, computed } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { staticImg } from '@/utils/config.js'
	import { toUrl, Toast, imgUrls } from '@/utils/utils.js'
	import Http from '@/utils/request.js'
	import statusBar from '../components/statusBar.vue'
	
	const list = computed(() => {
		return [
			{ title: '基本信息', icon: 'file_jbxx.png', path: `/bizPage/personnel/basicInfo?employeeId=${employeeId.value}` },
			{ title: '劳动合同', icon: 'file_ldht.png', path: '/bizPage/docs/fileList?dirId=22&title=劳动合同' },
			{ title: '活动情况', icon: 'file_hdqk.png', path: '/bizPage/activity/list' },
			{ title: '考勤情况', icon: 'file_kqqk.png', path: '/bizPage/docs/fileList?dirId=7&title=考勤记录' },
			{ title: '辞职申请', icon: 'file_czsq.png', path: '/bizPage/docs/fileList?dirId=28&title=离职审批单' },
			{ title: '辞退通知', icon: 'file_cttz.png', path: '/bizPage/docs/fileList?dirId=30&title=辞退通知' },
			// { title: '奖励', icon: 'file_jl.png', path: '/bizPage/notice/award?type=1' },
			// { title: '训诫', icon: 'file_xj.png', path: '/bizPage/notice/award?type=2' },
			{ title: '调岗', icon: 'file_dg.png', path: '/bizPage/docs/fileList?dirId=27&title=调岗通知' },
			{ title: '规章制度学习', icon: 'file_gzzd.png', path: '/bizPage/docs/fileList?dirId=8&title=规章制度' },
			{ title: '工作交接', icon: 'file_gzjj.png', path: '/bizPage/docs/fileList?dirId=29&title=离职交接单' },
			{ title: '薪酬结算', icon: 'file_xcjs.png', path: '/bizPage/docs/fileList?dirId=9&title=工资表' },
			// { title: '复议档案', icon: 'file_fyda.png' },
			// { title: '工作建议', icon: 'file_gzjy.png' }
		]
	})

	const employeeId = ref('')
	const pageData = ref('')

	onLoad((e) => {
		if(e.employeeId) employeeId.value = e.employeeId
		getInfo()
	})

	const getInfo = () => {
		Http.get({
			url: '/hr/Employee/detail',
			data: {
				employeeId: employeeId.value
			}
		}).then(res => {
			if(res.code != 0) return Toast(res.msg)
			pageData.value = res.data
		})
	}
</script>

<style lang="scss" scoped>
	.bizPage {
		min-height: 100vh;
		background: #F9F9F9;
	}
	.head {
		height: 148rpx;
		border-radius: 20rpx;
		padding: 0 30rpx 0 40rpx;
		.back {
			width: 700rpx;
			height: 128rpx;
			background: linear-gradient(180deg, #267FE9, #FFFFFF);
			border-radius: 20rpx 20rpx 0rpx 0rpx;
			opacity: 0.1;
			top: 6rpx;
			left: 50%;
			transform: translateX(-50%);
		}
		.avatar {
			width: 90rpx;
			height: 90rpx;
			border-radius: 50%;
		}
	}
	.main {
		border-radius: 20rpx;
		padding: 0 20rpx;
		.item {
			width: 50%;
			height: 100rpx;
			padding: 0 14rpx;
			border-bottom: 1rpx solid #F2F2F2;
			&:nth-child(odd) {
				padding-right: 40rpx;
			}
			.icon {
				width: 30rpx;
				height: 36rpx;
			}
		}
	}
</style>
